#!/usr/bin/env python

# @Time    : 2023/9/02 10:38
# @code_by  : zhaoxc


logs = '''
111.30.144.7 "POST /mock/login/?t=GET HTTP/1.1" 200 
111.30.144.7 "Get /mock/users/?t=POST HTTP/1.1" 200 
111.13.100.92 "Post /mock/login/ HTTP/1.1" 200 
223.88.60.88 "GET /mock/users/?t=POST HTTP/1.1" 200 
111.30.144.7 "GET /mock/users/ HTTP/1.1" 200 
'''
### 以双引号为分割符号，把源字符处理成字符串，通过字符串开头数字来匹配
s = logs.split('\"')
print(s)
Post = 0
Get = 0
for i in range(len(s)):
    if s[i][0] == 'P':
        Post += 1
    elif s[i][0] == 'G':
        Get += 1
print("POST请求数量为 {} 个".format(Post))
print("GET请求数量为 {} 个".format(Get))

